#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2019/2/19 10:49
@desc
"""

import threading
import socket               # 导入 socket 模块
import time

def func():
    s = socket.socket()         # 创建 socket 对象
    host = socket.gethostname() # 获取本地主机名
    port = 12345                # 设置端口好
    s.connect((host, port))
    print(s.recv(1024))
    s.send('hello')
    time.sleep(1)
    print(s.recv(1024))
    s.close()


for i in range(20):
    threading.Thread(target=func).start()